<?php
namespace app\common\validate\Subject;
use think\Validate;
class Subject extends Validate{
    protected $rule = [
        'title' => ['require','unique:subject'],
        'content' => ['require'],
        'cateid'=>['require'],
        'price' => ['require'],
    ];

    // 错误提示信息
    protected $message = [
        'title.require' => '课程标题必填',
        'content.require' => '课程内容必填',
        'cateid.require' => '课程分类必选',
        'price.require' => '价格必填',
        'title.unique' => '课程标题必须是唯一',
    ];
       // 验证场景
       protected $scene = [
        // 用户编辑资料的场景
        'edit' => ['title']
    ];
}